package com.jeeplus.test.query.controller;

import com.jeeplus.test.query.service.MenuQueryService;
import com.jeeplus.test.query.view.MenuTreeView;
import com.jeeplus.test.tools.resp.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author sgy
 * @description 菜单查询接口
 * @date 2025/7/18
 */
@Api(tags = "菜单")
@Slf4j
@RequestMapping("/query/menu")
@RequiredArgsConstructor
@RestController
public class MenuQueryController {
    private final MenuQueryService menuQueryService;

    /**
     * 查询目录树
     *
     * @param officeId，机构ID
     */
    @ApiOperation("查询学院目录树")
    @GetMapping("/tree")
    public R<List<MenuTreeView>> tree(@RequestParam(value = "officeId",required = true)Long officeId,@RequestParam(value = "treeType",required = false)String treeType) {
        List<MenuTreeView> result = menuQueryService.queryMenuTree(officeId,treeType);
        return R.suc(result);
    }


//     @ApiOperation("查询学院目录树")
//    @GetMapping("/tree")
//    public Map<String, Object> tree(@RequestParam(value = "officeId")String officeId, @RequestParam(value = "treeType")String treeType, @RequestParam(required = false, defaultValue = "false") boolean hasName) {
//        return menuQueryService.queryMenuTree(officeId,treeType,hasName);
//    }

//    @ApiOperation("查询学院目录树")
//    @GetMapping("/tree")
//    public R<List<MenuTreeView>> tree(@RequestParam(value = "officeId",required = true)String officeId,@RequestParam(value = "officeId",required = true)String treeType) {
//        List<MenuTreeView> result = menuQueryService.queryMenuTree(officeId);
//        return R.suc(result);
//    }


}
